<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('tatib' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$jid = isset( $_GET['jid'] ) ? $_GET['jid']:  0;
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$sid = isset( $_GET['sid'] ) ? $_GET['sid']:  0;

$modulname = "Personalia _BN_ Pembinaan _BN_ Tata Tertib";
 
if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){ 
		case "edit_detail_page":
			if(submit_tatib_detail($id , $sid)){
				generate_my_web('Updated', $pagename ,"plain.php");
			} else {
				generate_my_web('Failed', $pagename ,"plain.php");
			}
			exit;
		break; 
		case "edit_page":
			if(submit_tatib($id)){
				generate_my_web('Updated', $pagename ,"plain.php");
			} else {
				generate_my_web('Failed', $pagename ,"plain.php");
			}
			exit;
		break;
	}

else: 	
	if($task == "detail"){ 
		$pagename = $modulname." _BN_ Detail";
		load_facebox_script();
		$content = detail_tatib($jid);
	}elseif($task == "edit"){ 
		$pagename = ($id > 0 ) ? "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=tatib&task=edit_page&id='.$id , $pagename , 190	);
	}elseif($task == "edit_page"){
		$content = form_tatib($id);
		generate_my_web($content, '' ,"plain.php");
		exit;
	}elseif($task == "edit_detail"){ 
		$pagename = ($sid > 0 ) ? "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=tatib&task=edit_detail_page&id='.$id.'&sid='.$sid , $pagename , 310	);
	}elseif($task == "edit_detail_page"){
		$content = form_tatib_detail($sid , $id);
		generate_my_web($content, '' ,"plain.php");
		exit;
	}else{ 
		$pagename = $modulname;
		load_facebox_script();
		$content =  list_tatib(); 
	}
endif;  
generate_my_web($content, $pagename );
?>